﻿using System;
using System.Web.UI.WebControls;

namespace EnhancedSolutions
{
    class Helper
    {
        /// <summary>
        /// Sets the text of a specific label control to the status message provided.
        /// </summary>
        /// <param name="_label">The _label.</param>
        /// <param name="_status">The _status.</param>
        public static void SetStatus(Label _label, StatusMessage _status)
        {
            _label.Text = _status.Message;
            _label.ForeColor = _status.Color;
        }

        /// <summary>
        /// Gets the temporary path.
        /// </summary>
        /// <param name="_filename">The _filename.</param>
        /// <returns>
        /// Returns a path to the temporary folder.
        /// </returns>
        public static string GetTemporaryPath(string _filename)
        {
            string savePath = String.Format("{0}{1}", System.IO.Path.GetTempPath(), _filename);
            return savePath;
        }

        /// <summary>
        /// Gets the temporary path.
        /// </summary>
        /// <returns>
        /// Returns a path to the temporary folder with a guid as filename.
        /// </returns>
        public static string GetTemporaryPath()
        {
            string savePath = String.Format("{0}{1}", System.IO.Path.GetTempPath(), System.Guid.NewGuid().ToString());
            return savePath;
        }
    }
}
